<div class="col-md-8">
<div class="main-content" id="main-content">
	<div class="sub-content">
		<div class="top-header products clearfix">
			<div class="pull-left pad">
				<h1>Categories List</h1>
			</div>
			<div class="product-list-details">
				<a href="<? echo $this->Url('products')?>/add-category"><input type="button" value="Add category" class="btn" /></a>
			</div>
		</div><br/>
		<div class="product_table table-responsive">
		</div>
	</div>
</div></div>
<script>
$(function(){
$('.product_table').html('Please wait loading....');
	$.ajax({
		type:	'GET',
		dataType:'json',
		url: BASE_PATH+'/products/allcategories-ajax',
		success: function(data){
		$('.product_table').html('<table border="1" cellpadding="0" class="table table-bordered" cellspacing="0" width="100%" id="search_results"><thead><tr class="bg_header"><td>SNO</td><td>Category Name</td><td>Action</td></tr></thead><tbody></tbody></table>');	
		eval(data);
		var oTable = $('#search_results').dataTable( {
					aoColumnDefs: [{bSortable: false,
									aTargets: [ 0 ]
									}],
					"bStateSave": true,
					"bAutoWidth": true,
					"sRowSelect": "multi",
					"sPaginationType": "full_numbers",
					"bProcessing": true,
 					"aaData": data,
					"aoColumns": [
						{ "mData": "sno" },
						{ "mData": "category_name" },
						{ "mData": "action" }						
					] 
				});			
		}
	});
});
function deleteCategory(cat_id){
	if(confirm("Are you sure you want delete record?")){
		window.location=BASE_URL+"/products/delete-category?category_id="+cat_id;					
	}
}
</script>